package com.sina.microblog.ut.utils
{
	import flash.net.URLVariables;

	public class URLRequestParameters
	{
		private var getData:Array = [];
		private var postData:URLVariables = new URLVariables();
		
		public function URLRequestParameters(source:String)
		{
			addParam("source", source);
		}
		public function addParam(key:String, value:Object):void
		{
			getData.push(key+"="+String(value));
			postData[key]=value;
		}
		public function toGetString():String
		{
			getData.sort();
			return "?" + getData.join("&");
		}
		public function makeQueryStr(sinceID:uint=0, maxID:uint=0, count:uint=0, page:uint=0):void
		{		
			if ( sinceID > 0 )
			{
				addParam("since_id", sinceID );
			}
			if ( maxID > 0 )
			{
				addParam("max_id", maxID);
			}
			if ( count > 0 )
			{
				addParam("count", count );
			}
			if ( page > 0 )
			{
				addParam("page" , page );
			}
			
		}
		public function toPostData():URLVariables
		{
			return postData;
		}
	}
}